<extend name="Bt/register_back_base"/>
<block name="content">
    <div class="context" style="position: relative;height:900px">
        <div class="ctPdding ">
            <div class="ct_header"><i></i>找回密码</div>
            <hr />
            <div class="regContainer">
                <div class="regItme">
                    <ul>
                        <li>
                            <span class="noRegLogo">1</span>
                            <span class="color6">填写注册邮箱</span>
                        </li>
                        <li class="itmeTwo">
                            <span class="noRegLogo">2</span>
                            <span class="color6">激活账户</span>
                        </li>
                        <li class="itmeBorder">
                            <span class="regLogo">3</span>
                            <span class="color6">设置新密码</span>
                        </li>
                    </ul>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="regGroupContainer">
                <form class="login-form" action="__SELF__" method="post">

                    <div class="userContainer marginTop50 marginBottom20">
                        <input type="password" id="inputPasswordy"  class="userStyle" placeholder="请输入{:L('_OLD_PW_')}" name="old">
                        <img class="userMsg" src="__IMG__/bt/err_small_a1085c53.png" style="display: none"/>
                        <span class="size12 colorRed" style="display: none">asdasd</span>
                        <div class="userLogo"><img src="Application/Home/Static/bt/img/user/userlogo.png"/></div>
                    </div>

                    <div class="userContainer marginBottom20">
                        <input type="password" id="inputPassword"  class="userStyle" placeholder="请输入{:L('_PW_NEW_')}" name="password">
                        <img class="userMsg" src="__IMG__/bt/err_small_a1085c53.png" style="display: none"/>
                        <span class="size12 colorRed" style="display: none">asdasd</span>
                        <div class="userLogo"><img src="Application/Home/Static/bt/img/user/userlogo.png"/></div>
                    </div>

                    <div class="userContainer marginBottom20">
                        <input type="password" id="inputPassword2" class="userStyle" placeholder="{:L('_PW_CONFIRM_')}" name="repassword">
                        <img class="userMsg" src="__IMG__/bt/err_small_a1085c53.png" style="display: none"/>
                        <span class="size12 colorRed" style="display: none">asdasd</span>
                        <div class="userLogo"><img src="Application/Home/Static/bt/img/user/userlogo.png"/></div>
                    </div>

                    <div class="userContainer marginBottom20">
                        <div class="userLogoBtn stratHover">下一步</div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</block>

<block name="javascriptPageLeveCode">
    <script type="text/javascript">
        $(function(){
            //提交
            $('.userLogoBtn').on('click',function(){

                $('.userMsg').hide();

                $('.colorRed').hide();

                var inputPassword = $('#inputPassword').val();

                var inputPassword2 = $('#inputPassword2').val();

                    if(inputPassword != inputPassword2){

                        $('#inputPassword').nextAll('.userMsg').show();

                        $('#inputPassword').nextAll('.colorRed').text('两次输入的密码不一样~！').show();

                        $('#inputPassword2').nextAll('.userMsg').show();

                        $('#inputPassword2').nextAll('.colorRed').text('两次输入的密码不一样~！').show();

                        return false;
                    }

                var self = $('form');

                $.post(self.attr("action"), self.serialize(), function(data){
                    console.log(data);
                    if (data.status) {
                        setTimeout(function () {
                            console.log(data.url);
                            window.location.href = data.url;
                        }, 10);
                    } else {

                        if(data.info==-4){

                            $('#inputPassword').nextAll('.userMsg').show();

                            $('#inputPassword').nextAll('.colorRed').text("密码不能少于6个字符").show();
                        }

                        if(data.info.indexOf("密码不正确") >=0 || data.info.indexOf("原")>=0){

                            $('#inputPasswordy').nextAll('.userMsg').show();

                            $('#inputPasswordy').nextAll('.colorRed').text(data.info).show();

                            return false;
                        }
                        $('#inputPassword').nextAll('.userMsg').show();

                        $('#inputPassword').nextAll('.colorRed').text(data.info).show();
                    }
                }, "json");
            });

            //加工昵称
            $('#email').on('input propertychange',function(){
                $('#nickname').val(hex_md5($(this).val()));
            });
        });
    </script>
</block>